package com.leon.learnenginespace.drools.dao;

import com.leon.learnenginespace.drools.pojo.OrganPojo;
import com.leon.learnenginespace.drools.pojo.TDrlProSaleRule;
import com.leon.learnenginespace.drools.pojo.TDrlSceneConfig;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @Title: ProSaleRuleMapper
 * @Author WT
 * @Package com.sinosoft.msf.dao
 * @Date 2023/7/4 11:31
 * @description: 产品销售规则持久层
 */
@Mapper
public interface ProSaleRuleMapper {
    /**
     * 根据产品编码查找销售规则配置信息
     *
     * @param proSaleRule
     * @return
     */
    List<TDrlProSaleRule> querySaleRule(TDrlProSaleRule proSaleRule);

    /**
     * 根据产品编码及交费期间查找屏蔽机构
     *
     * @param proSaleRule
     * @return
     */
    List<OrganPojo> queryOrganByRiskAndYear(TDrlProSaleRule proSaleRule);

    /**
     * 保存产品销售规则
     *
     * @param tDrlProSaleRule
     * @return
     */
    int createProdRule(TDrlProSaleRule tDrlProSaleRule, String payYear, OrganPojo organPojo);

    /**
     * 更新产品销售规则
     *
     * @param tDrlProSaleRule
     * @param payYear
     * @param organPojo
     * @return
     */
    int updateProdRule(TDrlProSaleRule tDrlProSaleRule, String payYear, OrganPojo organPojo);

    /**
     * 删除产品销售规则
     *
     * @param tDrlProSaleRule
     * @param payYear
     * @return
     */
    int deleteProdRule(TDrlProSaleRule tDrlProSaleRule, String payYear, OrganPojo organPojo);


    /**
     * 获取规则内容模板
     *
     * @param templateId
     * @return
     */
    String queryRuleTemplate(String templateId);

    /**
     * 查找产品销售规则的规则ID及绑定ID，包括已删除的数据
     *
     * @param riskCode
     * @param year
     * @param organId
     * @return
     */
    TDrlProSaleRule querySaleRuleId(String riskCode, String year, String organId);

    /**
     * 返回场景信息
     *
     * @param sceneCode
     * @return
     */
    TDrlSceneConfig queryScene(String sceneCode);

}
